package com.gdk.ksoft.assembly.dialog;

import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.view.View;
import android.view.WindowManager;
import android.widget.PopupWindow;
import android.widget.TextView;

import com.gdk.ksoft.R;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;

/**
 * Created by Mrper on 2014/11/22.
 * 主页主菜单
 */
public class MainOperatorMenu extends PopupWindow {

    @ViewInject(R.id.menu_main_operator_itemReport)private TextView txtReport;//查看报表
    @ViewInject(R.id.menu_main_operator_itemExit)private TextView txtExit;//退出程序
    @ViewInject(R.id.menu_main_operator_itemUpdate)private TextView txtUpdate;//更新数据
    @ViewInject(R.id.menu_main_operator_itemUpload)private TextView txtUpload;//上传数据
    @ViewInject(R.id.menu_main_operator_itemCancel)private TextView txtCancel;//取消

    public MainOperatorMenu(Context context){
        super();
        View rootView = View.inflate(context, R.layout.menu_main_operator, null);
        ViewUtils.inject(this, rootView);
        setContentView(rootView);
        setBackgroundDrawable(new ColorDrawable(Color.argb(100,0,0,0)));
        setFocusable(true);
        setAnimationStyle(R.style.MainPopupMenuStyle);
        setWidth(WindowManager.LayoutParams.MATCH_PARENT);
        setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
    }

    public void setOnMenuItemClickListener(View.OnClickListener listener){
       if(listener!=null){
           txtReport.setOnClickListener(listener);
           txtExit.setOnClickListener(listener);
           txtUpdate.setOnClickListener(listener);
           txtUpload.setOnClickListener(listener);
           txtCancel.setOnClickListener(listener);
       }
    }

}
